<?php
  class Plugins_Newtour extends model {
  
  function getformadd($productid="")
  {
  $code  = '<div class="itPlg">'."\n";
$code .= '<form class="wrpDtnPlg">'."\n";
$code .= '<fieldset class="dtnPlg">'."\n";
$code .= '<div class="destinPlg fs04 clTxt2">'."\n";
$code .= '<label>Destination</label><br>'."\n";
$code .= '<div class="wrpInpDtnPlg">'."\n";
$code .= '<div class="reDesign reDsShp">'."\n";

$arrayset=$this->getprovince();
$code .= '<select name="destination" >'."\n";
$code .= '<option value="">Choose Province</option>'."\n";
if(count($arrayset))
{
foreach($arrayset as $keyset=> $valueset)
{
$code .= '<option value="'.$keyset.'">'.$valueset.'</option>'."\n";
}
}
$code .= '</select>'."\n";

$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</fieldset>'."\n";
$code .= '</form>'."\n";
$code .= '</div>';
  
  $arraydata['form'][]=addslashes(str_replace(array("\r", "", "\r"), '', $code));  
  
  
  
  $code  = '<div class="wrprAddCtnt wrprAddNewMyTrip">'."\n";
$code .= '<h2 class="fs09 clTxt2">Title</h2>'."\n";
$code .= '<div class="wrpAddCtnt clBg4 clBd2 bdFull">'."\n";
$code .= '<div class="wrpStaticAddCtnt">'."\n";
$code .= '<div class="itPlg">'."\n";
$code .= '<form class="wrpPmtPlg">'."\n";
$code .= '<fieldset class="pmtPlg">'."\n";
$code .= '<div class="prdPlg fs04 clTxt2">'."\n";
$code .= '<div class="wrpHdInfoGen mgBtm10 clBd2 bdBtm">'."\n";
$code .= '<h2 class="fs04 clTxt2">Duration</h2>'."\n";
$code .= '</div>'."\n";
$code .= '<div>'."\n";


$code .= '<div class="inpDate">'."\n";
$code .= '<span class="clTxt3">Start Date</span>'."\n";
$code .= '<input type="text" name="startdate[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2 " >'."\n";
$code .= '</div>'."\n";

$code .= '<div class="inpDate">'."\n";
$code .= '<span class="clTxt3">End Date</span>'."\n";
$code .= '<input type="text" name="enddate[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2 " >'."\n";
$code .= '</div>'."\n";


$code .= '<div class="inpDrt">'."\n";
$code .= '<span class="clTxt3">Day*</span>'."\n";
$code .= '<input type="text" name="day[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">'."\n";
$code .= '</div>'."\n";

$code .= '<div class="inpDrt">'."\n";
$code .= '<span class="clTxt3">Night</span>'."\n";
$code .= '<input type="text" name="night[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">'."\n";
$code .= '</div><br>'."\n";



$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</fieldset>'."\n";
$code .= '</form>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="itPlg">'."\n";
$code .= '<form class="wrpShpPlg">'."\n";
$code .= '<fieldset class="ShpPlg">'."\n";
$code .= '<div class="prcPlg fs04 clTxt2">'."\n";
$code .= '<div class="wrpHdInfoGen mgBtm10 clBd2 bdBtm">'."\n";
$code .= '<h2 class="fs04 clTxt2">Price</h2>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="wrpInpShpPlg">'."\n";

$code .= '<input type="text" placeholder="Sale Price"  name="saleprice[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">'."\n";

$code .='<span class="totextset"> To </span>';

$code .= '<input type="text" placeholder="Regular Price" name="price[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">'."\n";

$code .= '<div class="reDesign reDsShp">'."\n";
  
   $arraycurrency=$this->getcurrency();
 //  $option=array();
//   $option['0']="Please select Currency";
//  if(count($arraycurrency))
//  foreach($arraycurrency as $keycountry=> $valuecountry)
//  $option[$keycountry]=$valuecountry;
//  
//  $selectbox4=new Element_Select("", "curid[]",$option);
//  $strbox=$selectbox4->render(1);


//=$code .= '<select name="curid[]">'."\n";
//$code .= '<option value="Baht">Baht</option>'."\n";
//$code .= '<option value="US Dollar">US Dollar</option>'."\n";
//$code .= '</select>'."\n";
$strbox='';
if(count($arraycurrency))
{
$strbox .= '<select name="curid[]">'."\n";
foreach($arraycurrency as $keycur=>$valuecur)
{
$strbox .= '<option value="'.$keycur.'">'.$valuecur.'</option>'."\n";

}
$strbox .= '</select>'."\n";
}

$code.=$strbox;

$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</fieldset>'."\n";
$code .= '</form>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="itPlg">'."\n";
$code .= '<form class="wrpCtcTripPlg">'."\n";
$code .= '<fieldset class="wrpCtcInfo">'."\n";
$code .= '<div class="wrpHdInfoGen mgBtm10 clBd2 bdBtm">'."\n";
$code .= '<h2 class="fs04 clTxt2">Contact</h2>'."\n";
$code .= '<input type="checkbox" id="cbCtc" name="samecontactprofile[]" value="'.$this->userdata['userid'].'" class="checkBoxDm">'."\n";
$code .= '<label for="cbCtc" class="userSlctNone clTxt3 fs02">Same as your profile</label>'."\n";
$code .= '</div>'."\n";
$code .= '<table class="tbGenInfo tbAddCtnt clTxt3 fs03">'."\n";
$code .= '<tbody><tr>'."\n";
$code .= '<th>Facebook</th>'."\n";
$code .= '<td><input type="text" name="facebook[]" placeholder="e.g. facebook.com/dmconnex" class="clBg5 clBd2 fs03 clTxt2"></td>'."\n";
$code .= '</tr>'."\n";
$code .= '<tr>'."\n";
$code .= '<th>Twitter</th>'."\n";
$code .= '<td><input type="text" name="twitter[]" placeholder="e.g. twitter.com/dmconnex" class="clBg5 clBd2 fs03 clTxt2"></td>'."\n";
$code .= '</tr>'."\n";
$code .= '<tr>'."\n";
$code .= '<th>Google+</th>'."\n";
$code .= '<td><input type="text" name="googleplus[]" placeholder="e.g. plus.google.com/+dmconnex" class="clBg5 clBd2 fs03 clTxt2"></td>'."\n";
$code .= '</tr>'."\n";
$code .= '<tr>'."\n";
$code .= '<th>Website</th>'."\n";
$code .= '<td><input type="text" name="website[]" class="clBg5 clBd2 fs03 clTxt2"></td>'."\n";
$code .= '</tr>'."\n";
$code .= '<tr>'."\n";
$code .= '<th>Email</th>'."\n";
$code .= '<td><input type="text" name="email[]" class="clBg5 clBd2 fs03 clTxt2"></td>'."\n";
$code .= '</tr>'."\n";
$code .= '<tr>'."\n";
$code .= '<th>Phone</th>'."\n";
$code .= '<td><input type="text" name="phone[]" class="clBg5 clBd2 fs03 clTxt2"></td>'."\n";
$code .= '</tr>'."\n";
$code .= '<tr>'."\n";
$code .= '<th>Fax</th>'."\n";
$code .= '<td><input type="text" name="fax[]" class="clBg5 clBd2 fs03 clTxt2"></td>'."\n";
$code .= '</tr>'."\n";
$code .= '<tr>'."\n";
$code .= '<th>ETC</th>'."\n";
$code .= '<td><textarea placeholder="e.g. instragram@dmconnex" name="etc[]" class="clBg5 clBd2 fs03 clTxt2"></textarea></td>'."\n";
$code .= '</tr>'."\n";
$code .= '</tbody></table>'."\n";
$code .= '</fieldset>'."\n";
$code .= '</form>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
//$code .= '<div class="ftrAddCtnt">'."\n";
//$code .= '<div class="wrpBtnAddTrip clearfix">'."\n";
//$code .= '<input type="submit" value="Back" class="btnGen clTxtW cutTxt clBgBt1 fs04 btnBack">'."\n";
//$code .= '<input type="submit" value="Next" class="btnGen clTxtW cutTxt clBgSp2 fs04 btnNext">'."\n";
//$code .= '</div>'."\n";
//$code .= '</div>'."\n";
$code .= '</div>';





  $arraydata['form'][]=addslashes(str_replace(array("\r", "", "\r"), '', $code));  
  
  
  
$code  = '<div class="wrprAddCtnt wrprAddNewMyTrip">'."\n";
$code .= '<h2 class="fs09 clTxt2">Title</h2>'."\n";
$code .= '<div class="wrpAddCtnt clBg4 clBd2 bdFull">'."\n";
$code .= '<div class="itPlg addMapPlg">'."\n";
$code .= '<div class="wrpPlg clBg5 clBd2 bdFull">'."\n";
$code .= '<div class="plgArea"></div>'."\n";
$code .= '<div class="icoDefFullPf">'."\n";
$code .= '<span class="ico icoMapDefFullPf"></span>'."\n";
$code .= '<span>Map</span>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="itPlg addTripPlg addTripTmln">'."\n";
$code .= '<div class="wrprTripTmln">'."\n";
$code .= '<div class="btnDateTripTmln">'."\n";
$code .= '</div>'."\n";
$code .= '<div class="wrpTripTmln">'."\n";
$code .= '<div class="wrpInTripTmln">'."\n";
$code .= '<div class="wrpBBTmln">'."\n";
$code .= '<div class="bBTmln clBgBt2"></div>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="wrpPntTmln">'."\n";

//$code .= '<div class="pntTmln clearfix">'."\n";

//$code .= '<div class="timeTmln">'."\n";
//$code .= '<span class="fs03 boldGen">ADD</span>'."\n";
//$code .= '</div>'."\n";

//$code .= '<div class="dotTmln">'."\n";
//$code .= '<span class="clBgBt1">'."\n";
//$code .= '<em class="clTxtW boldGen fs03">+</em>'."\n";
//$code .= '</span>'."\n";
//$code .= '</div>'."\n";

//$code .= '<div class="wrpActvtTmln clearfix">'."\n";

//$code .= '<div class="triTmln">'."\n";
//$code .= '<span class=""></span>'."\n";
//$code .= '</div>'."\n";

//$code .= '<div class="actvtTmln clBg5 clBd2 bdFull clearfix">'."\n";

//$code .= '<a class="wrpBtnAddNewTrip">'."\n";
//$code .= '<div class="imgActvtTmln">'."\n";
//$code .= '<img src="/img/newtrip.png" alt="img">'."\n";
//$code .= '</div>'."\n";
//$code .= '</a>'."\n";

//$code .= '</div>'."\n";

//$code .= '</div>'."\n";

//$code .= '</div>'."\n";

$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>';


$arraydata['form'][]=addslashes(str_replace(array("\r", "", "\r"), '', $code)); 
  
  
  return $arraydata; 
  }
  
  function saveplugin($arraydata,$productid,$plugreid)
  {
  
  $arraydata2=$arraydata;
  $arraydata2['productid']=$productid;
  $arraydata2['plugreid']=$plugreid;
  

 // if($arraydata['simgmid'])$arraydata['simgmid']=$this->swicthpathimage($arraydata['simgmid'],$productid);
//  if($arraydata['imgmid'])$arraydata['imgmid']=$this->swicthpathimage($arraydata['imgmid'],$productid);
  
  unset($arraydata2['objdata']); 
  
  $this->db->db_set($arraydata2,'tb_plugins_newtour');
  $sql="delete from tb_plugins_poi where productid=".$productid;
  $this->db->db_delete($sql);
  if(count($arraydata['objdata']))
  {
  
  foreach($arraydata['objdata'] as $valuedata2)
  {
  
   $valuedata2['productid']=$productid;
   if($valuedata2['simgmid'])$valuedata2['simgmid']=$this->swicthpathimage($valuedata2['simgmid'],$productid);
   if($valuedata2['imgmid'])$valuedata2['imgmid']=$this->swicthpathimage($valuedata2['imgmid'],$productid);
   $this->db->db_set($valuedata2,'tb_plugins_poi');
  
  
  }
  
  
  }
  
  }
  
  function getplugin($plugreid)
  {
      $sql="select *,DATE_FORMAT(tb_plugins_newtour.startdate,'%d/%m/%Y') as startdate2,DATE_FORMAT(tb_plugins_newtour.enddate,'%d/%m/%Y') as enddate2 from tb_plugins_newtour where plugreid=".$plugreid;
  
  $arrayplugin=$this->db->db_set_1recordrow($sql);
 if($arrayplugin['samecontactprofile'])
  {
  $where=array();
  $select="facebook,twitter,googleplus,email,website,phone,fax,etc";
  $where['userid']=$arrayplugin['samecontactprofile'];
  $arrayplugin2= $this->getdatarow("tb_user",$select,$where,1);
  


  $arrayplugin['facebook']=$arrayplugin2['facebook'];
  $arrayplugin['twitter']=$arrayplugin2['twitter'];
  $arrayplugin['googleplus']=$arrayplugin2['googleplus'];
  $arrayplugin['email']=$arrayplugin2['email'];
  $arrayplugin['website']=$arrayplugin2['website'];
  $arrayplugin['phone']=$arrayplugin2['phone'];
  $arrayplugin['fax']=$arrayplugin2['fax'];
  $arrayplugin['etc']=$arrayplugin2['etc'];
  

  
  }
  
  
  if($arrayplugin['curid'])
     {
     $arrayplugin['currencyname'] =$this->getcurrencybycurid($arrayplugin['curid']);
     }else
     {
     $arrayplugin['currencyname']=""; 
     }
  
  
  
  $arrayplugin['objdata']=array();
  $arrayplugin['objdata2']=array();
  $sql="select *,DATE_FORMAT(tb_plugins_poi.plandate,'%h:%i %p') as plandate2  from tb_plugins_poi where productid=".$arrayplugin['productid'].' order by plandate asc';
  $arrayplugin3=$this->db->db_set_recordset($sql);
  $arraydatedata=array();
  $arraydatedata2=array();
  if(count($arrayplugin3)) 
  {
  

  foreach($arrayplugin3 as $valueplugin3)
  {
  //=$valueplugin3;
  
  if($valueplugin3['isactivity'])
  {
  $valueplugin3['img']= $this->getimagebyimgmid($valueplugin3['imgmid']);
  $valueplugin3['simg']= $this->getimagebyimgmid($valueplugin3['simgmid']);
  
  }else
  {
  
  $where=" where tb_product.productid=".$valueplugin3['sproductid'];
$arraydata5=$this->getproductbycondition($where,'','','','','',1);
  $valueplugin3['data']=$arraydata5[0];
  
  
  }
  
  if($valueplugin3['dateset'])
  {
  
  
  list($y,$m,$d)=explode("-",$valueplugin3['dateset']);
  $arraydatedata[$d.'/'.$m.'/'.$y][]=$valueplugin3;
  
  
  }
  
  
  
  
  }
  $arrayplugin['objdata']=$arraydatedata;
  
  
  

  
  if(count($arraydatedata))
  {
  foreach($arraydatedata as $keydatedata =>$valuedatedata)
  {
  
  $arrayplugin['objdata2'][]=array('date'=>$keydatedata,'data'=>$valuedatedata);
  
  }
  
  }
  
  
  }
  
  
 
  //$arrayplugin['img']= $this->getimagebyimgmid($arrayplugin['imgmid']);
 // $arrayplugin['simg']= $this->getimagebyimgmid($arrayplugin['simgmid']);
 


  
  return $arrayplugin;
  

  
  }  
  
  function getformlanding($arraydata)
  {
  
  
$code  = '<div class="ldIt wrpPmtLd"><input type="hidden" name="nowproductid" value="'.$arraydata['productid'].'">'."\n";
$code .= '<div class="wrpPmtLd">'."\n";
$code .= '<h2 class="clTxt2 fs04">Duration</h2>'."\n";
$code .= '<div class="pmtLd">'."\n";
$code .= '<span class="boldGen">'.$arraydata['day'].' Days '.$arraydata['night'].' Night</span>'."\n";

if($arraydata['enddate']!="0000-00-00")
{
$code .= '(<span>'.$arraydata['startdate2'].'</span>'."\n";
$code .= '<span> - </span>'."\n";
$code .= '<span>'.$arraydata['enddate2'].'</span>)'."\n";
}else
{
$code .= '(<span>'.$arraydata['startdate2'].'</span>'."\n";
$code .= '<span> - </span>'."\n";

$arraydata['enddate2']=date("d/m/Y",strtotime("+".$arraydata['day']." day",strtotime($arraydata['startdate2']))); 

$code .= '<span>'.$arraydata['enddate2'].'</span>)'."\n";

}


$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>';



if($arraydata['currencyname']!="")
{
$code .= '<div class="ldIt wrpOutPrcLd mgBtm20">'."\n";
$code .= '<div class="wrpPrcLd">'."\n";
$code .= '<h2 class="clTxt2 fs04">Price</h2>'."\n";

$priceset=$arraydata['price'];
if($arraydata['saleprice']!="0.00")
{
$priceset=$arraydata['saleprice'];

}

$code .= '<span class="prcLd">'.$priceset.' '.$arraydata['currencyname'].'</span>'."\n";


$code .= '</div>'."\n";
$code .= '</div>';
}
  
$code .= '<div class="wrpCtcInfo">'."\n";
$code .= '<div class="wrpHdInfoGen">'."\n";
$code .= '<h2 class="clTxt2 fs04">Contact</h2>'."\n";
$code .= '</div>'."\n";
$code .= '<table class="tbGenInfo tbCtcLd tbAddCtnt clTxt3 fs03">'."\n";
$code .= '<tbody>'."\n";

if(strpos($arraydata['facebook'],"facebook")!==false)
{
$datafacebook=$arraydata['facebook'];
if(strpos($arraydata['facebook'],"http")===false)
{
$datafacebook="http://".$arraydata['facebook'];

}


$code .= '<tr>';
$code .= '<th>Facebook</th>';
$code .= '<td><a href="'.$datafacebook.'" target="_blank">'.$datafacebook.'</a></td>';
$code .= '</tr>';
}
if(strpos($arraydata['twitter'],"twitter")!==false)
{
$datatwitter=$arraydata['twitter'];
if(strpos($arraydata['twitter'],"http")===false)
{
    $datatwitter="http://"+$arraydata['twitter'];

}
$code .= '<tr>';
$code .= '<th>Twitter</th>';
$code .= '<td><a href="'.$datatwitter.'" target="_blank">'.$datatwitter.'</a></td>';
$code .= '</tr>';
}
if(strpos($arraydata['googleplus'],"google")!==false)
{
$datatgoogleplus=$arraydata['googleplus'];
if(strpos($arraydata['googleplus'],"http")===false)
{
    $datatgoogleplus="http://"+$arraydata['googleplus'];

}

$code .= '<tr>';
$code .= '<th>Google+</th>';
$code .= '<td><a href="'.$datatgoogleplus.'" target="_blank" >'.$datatgoogleplus.'</a></td>';
$code .= '</tr>';

}
if($arraydata['website'])
{

if(strpos($arraydata['website'],'http') !== FALSE)
{
$code .= '<tr>';
$code .= '<th>Website</th>';
$code .= '<td><a href="'.$arraydata['website'].'" target="_blank" >'.$arraydata['website'].'</a></td>';
$code .= '</tr>';
}
}
if($arraydata['email'])
{
if(filter_var($arraydata['email'], FILTER_VALIDATE_EMAIL))
{
$code .= '<tr>';
$code .= '<th>Email</th>';
$code .= '<td>'.$arraydata['email'].'</td>';
$code .= '</tr>';
}
}
if($arraydata['phone'])
{
$code .= '<tr>';
$code .= '<th>Phone</th>';
$code .= '<td>'.$arraydata['phone'].'</td>';
$code .= '</tr>';
}
if($arraydata['fax'])
{
$code .= '<tr>';
$code .= '<th>Fax</th>';
$code .= '<td>'.$arraydata['fax'].'</td>';
$code .= '</tr>';
}
if($arraydata['etc'])
{




if(strpos($arraydata['etc'],'http') !== FALSE)
{
$arraydata['etc']='<a href="'.$arraydata['etc'].'" target="_blank">'.$arraydata['etc'].'</a>';

}

$code .= '<tr>';
$code .= '<th>ETC</th>';
$code .= '<td>'.$arraydata['etc'].'</td>';
$code .= '</tr>';
}


$code .= '</tbody></table>'."\n";
$code .= '</div>';


$data['str']=$code;
$data['target']='firsttarget';


if(count($arraydata['objdata']))
{


$code="";
$code .='<div class="ldIt wrpMapLd clBg4 w640 mapdataroute" >'."\n";
$code .= '<div class="icoDefLd">'."\n";
$code .= '<span class="ico icoMapDefLd"></span>'."\n";
$code .= '<span>Map</span>'."\n";
$code .= '</div>'."\n";
$code .= '</div>';



$code .= '<div class="ldIt wrpLdTripTmln clBg4 w640 clearfix">'."\n";
$code .= '<div class="wrprTripTmln">'."\n";
$code .= '<div class="btnDateTripTmln">'."\n";

$rowdata=1;
$firsttime="dateTripTmlnAct";
$objecttourcheck=array();
//echo "<pre>";
//print_r($arraydata['objdata']);
//echo "</pre>;";
//exit;
if(count($arraydata['objdata']))
{
foreach($arraydata['objdata'] as $keydata=> $valueobjdata)
{
//$date=date("d/m/Y",strtotime("+".$rowdata." day",strtotime($arraydata['startdate2'])));
$date=$keydata;
$code .= '<button id="rowdaynumset-'.$rowdata.'" onclick="opentourdata('.$rowdata.',1)" class="dateTripTmln clTxtW clBgBt1 fs04 '.$firsttime.'">'.$keydata.'</button>'."\n";
$firsttime='';

$objecttourcheck[$date]=array();
$rowdata2=0;
if(count($valueobjdata))
{

foreach($valueobjdata as  $valueobjdata2)
{


if($valueobjdata2['isactivity'])
{
$objecttourcheck[$date][$rowdata2]['productid']=0;
$objecttourcheck[$date][$rowdata2]['title']=$valueobjdata2['title'];
$objecttourcheck[$date][$rowdata2]['desc']=$valueobjdata2['description'];
$objecttourcheck[$date][$rowdata2]['timeset']=$valueobjdata2['timeset'];
$objecttourcheck[$date][$rowdata2]['type']=2;
$objecttourcheck[$date][$rowdata2]['lat']=$valueobjdata2['lat'];
$objecttourcheck[$date][$rowdata2]['lng']=$valueobjdata2['lng'];
$objecttourcheck[$date][$rowdata2]['simg']=$valueobjdata2['simg'];
$objecttourcheck[$date][$rowdata2]['imgmid']=$valueobjdata2['imgmid'];
$objecttourcheck[$date][$rowdata2]['simgmid']=$valueobjdata2['simgmid'];

}else
{



$objecttourcheck[$date][$rowdata2]['productid']=$valueobjdata2['data']['productid'];
$objecttourcheck[$date][$rowdata2]['title']=$valueobjdata2['data']['title'];
$objecttourcheck[$date][$rowdata2]['desc']=$valueobjdata2['data']['description'];
$objecttourcheck[$date][$rowdata2]['timeset']=$valueobjdata2['timeset'];
$objecttourcheck[$date][$rowdata2]['type']=1;
$objecttourcheck[$date][$rowdata2]['simg']=$valueobjdata2['data']['simg'];
$objecttourcheck[$date][$rowdata2]['imgmid']=$valueobjdata2['data']['imgmid'];
$objecttourcheck[$date][$rowdata2]['simgmid']=$valueobjdata2['data']['simgmid'];

$latsettrip=0;
$lngsettrip=0;
if(count($valueobjdata2['data']['plugins']))
{
foreach($valueobjdata2['data']['plugins'] as $valueplugins)
{
if($valueplugins['plugname']=="map")
{


$latsettrip=$valueplugins['lat'];
$lngsettrip=$valueplugins['lng'];



}

}
}
$objecttourcheck[$date][$rowdata2]['lat']=$latsettrip;
$objecttourcheck[$date][$rowdata2]['lng']=$lngsettrip;

}

$rowdata2++;
}
}
//$code .= '<button class="dateTripTmln clTxtW clBgBt1 fs04">12/03/2014</button>'."\n";
//$code .= '<button class="dateTripTmln clTxtW clBgBt1 fs04">13/03/2014</button>'."\n";
//$code .= '<button class="dateTripTmln clTxtW clBgBt1 fs04">14/03/2014</button>'."\n";

$rowdata++;
}

}


$code .= '</div>'."\n";

$code .= '<div class="wrpTripTmln">'."\n";

$code .= '<div class="wrpInTripTmln">'."\n";

$code .= '<div class="wrpBBTmln">'."\n";
$code .= '<div class="bBTmln clBgBt2"></div>'."\n";
$code .= '</div>'."\n";

$code .= '<div class="wrpPntTmln">'."\n";





$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>';

//
//$rowdata=1;
//$rowdata2=1;
// $rowset=0;
//$alphabet = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
//foreach($arraydata['objdata'] as $keydata=> $valueobjdata)
//{

//$code .= '<div class="ldIt wrpMyTripLd clBg4 w640 clearfix">'."\n";
//$code .= '<div class="wrpAtcPlg">'."\n";
//$code .= '<div class="spnHdDayTrip clTxtW">'."\n";
//$code .= '<span class="fs03">Day '.$rowdata.'</span><br>'."\n";
//$code .= '<span class="rcmAddGen fs01">'.$keydata.'</span>'."\n";
//$code .= '</div>'."\n";
//$code .= '</div>'."\n";
//$code .= '<div class="wrpPlgAreaTrip">'."\n";
//$code .= '<div class="plgAreaTrip clearfix">'."\n";
// if(count($valueobjdata))
// {

// foreach($valueobjdata as $valuedata2)
// {
// if($valuedata2['isactivity'])
// {
//$code .= '<div class="wrpInCell wrpInCellTrip w158 wrpActCell" style="margin:1px" onclick="popupactivites(\''.$valuedata2['title'].'\',\''.$valuedata2['description'].'\')">'."\n";
//$code .= '<div class="ovlCellTrip w158"></div>'."\n";
//$code .= '<a href="javascript:void(0)"  class="galleryimage"><img height="158" title="'.$valuedata2['img']['newpath'].'" width="158" alt="img" src="'.$valuedata2['simg']['newpath'].'" class="imgCell w158"></a>'."\n";
//$code .= '<div class="ldTtlCell ldTtlTrip fs05 clTxtCell cutTxt">'.$valuedata2['title'].'</div>'."\n";
//$code .= '<div class="timeTrip clTxtW fs01">'.date("h:i A",strtotime($valuedata2['plandate'])).'</div>'."\n";
//$code .= '<div class="pointTrip">'."\n";
//$code .= '<span class="clTxtW fs02">'.$rowdata2.'</span>'."\n";
//$code .= '</div>'."\n";
//$code .= '</div>';

//$rowdata2++;
// 
// }else
// {
// $lat="";
// $lng="";
// if(count($valuedata2['data']['plugins']))
// {
// foreach($valuedata2['data']['plugins'] as $valueplugins)
// {
// 
// if($valueplugins['plugid']==5)
// {
// $lat=$valueplugins['lat'];
// $lng=$valueplugins['lng'];
// 
// }
// 
// }
// 
// }
// 
//$code .= '<div class="wrpInCell wrpInCellTrip w158 pointTripData" onclick="linkto(\''.baseinfo.'/'.$valuedata2['data']['link'].'/'.$valuedata2['data']['productid'].'\')"  style="margin:1px">'."\n";
//$code .= '<div class="ovlCellTrip w158"></div>'."\n";
//$code .= '<a href="'.baseinfo.'/'.$valuedata2['data']['link'].'/'.$valuedata2['data']['productid'].'" target="_blank"><img height="158" width="158" alt="img" src="'.$valuedata2['data']['simg']['newpath'].'" class="imgCell w158"></a>'."\n";
//$code .= '<div class="ldTtlCell ldTtlTrip fs05 clTxtCell cutTxt">'.$valuedata2['data']['title'].'</div>'."\n";
//$code .= '<div class="timeTrip clTxtW fs01">'.date("h:i A",strtotime($valuedata2['plandate'])).'</div>'."\n";
//$code .= '<div class="pointTrip">'."\n";
//$code .= '<span class="clTxtW fs02">'.$alphabet[$rowset].'</span>'."\n";
//$code .= '</div><input type="hidden" value="'.$lng.'" name="lngset[]"><input type="hidden" value="'.$lat.'" name="latset[]">'."\n";
//$code .= '</div>';
//$rowset++;
// 
// }
// 
// 
// }
// }

//$code .= '</div>'."\n";


//$code .= '</div>'."\n";
//$code .= '</div>';


//$rowdata++;




//}

$data['str2']=$code;
$data['target2']='secondtarget';


$data['script']='objecttourcheck['.$arraydata['productid'].']={};objecttourcheck['.$arraydata['productid'].']='.json_encode($objecttourcheck).";opentourdata(1,1);";


}





return $data;
  
  }
  
  
  }
?>
